package com.zheng.damo01.DamoTest;

import com.zheng.damo01.Damoclass.Ainmal;
import com.zheng.damo01.Damoclass.Cat;
import com.zheng.damo01.Damoclass.Dog;

public class AinmalTest {
    public static void main(String[] args) {
        Cat cat=new Cat();
        Dog dog=new Dog();
        mathod(cat);
        mathod(dog);
    }
    public static void mathod(Ainmal ainmal){
        ainmal.eat();
        if (ainmal instanceof Dog ){
            Dog d=(Dog) ainmal;
            d.ran();
        }else if (ainmal instanceof Cat){
            Cat c=(Cat) ainmal;
            c.mathod1();
        }
    }
}
